# REQUIRES: x86
# RUN: yaml2obj %p/Inputs/hello32.yaml -o %t.obj
# RUN: lld-link -safeseh:no %t.obj %p/Inputs/std32.lib /subsystem:console \
# RUN:   /entry:main@0 /alternatename:___delayLoadHelper2@8=_main@0 \
# RUN:   /delayload:std32.dll /out:%t.exe
# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
# RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
# RUN: llvm-objdump --no-print-imm-hex -d %t.exe | FileCheck --check-prefix=DISASM %s

IMPORT:      Format: COFF-i386
IMPORT-NEXT: Arch: i386
IMPORT-NEXT: AddressSize: 32bit
IMPORT-NEXT: DelayImport {
IMPORT-NEXT:   Name: std32.dll
IMPORT-NEXT:   Attributes: 0x1
IMPORT-NEXT:   ModuleHandle: 0x3018
IMPORT-NEXT:   ImportAddressTable: 0x3020
IMPORT-NEXT:   ImportNameTable: 0x2040
IMPORT-NEXT:   BoundDelayImportTable: 0x0
IMPORT-NEXT:   UnloadDelayImportTable: 0x0
IMPORT-NEXT:   Import {
IMPORT-NEXT:     Symbol: ExitProcess (0)
IMPORT-NEXT:     Address: 0x401029
IMPORT-NEXT:   }
IMPORT-NEXT:   Import {
IMPORT-NEXT:     Symbol: MessageBoxA (0)
IMPORT-NEXT:     Address: 0x401033
IMPORT-NEXT:   }
IMPORT-NEXT: }

BASEREL:      BaseReloc [
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x1005
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x100C
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x101F
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x1025
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x102A
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x1034
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x1041
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: ABSOLUTE
BASEREL-NEXT:     Address: 0x1000
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x3020
BASEREL-NEXT:   }
BASEREL-NEXT:   Entry {
BASEREL-NEXT:     Type: HIGHLOW
BASEREL-NEXT:     Address: 0x3024
BASEREL-NEXT:   }
BASEREL-NEXT: ]

DISASM:      1029:      b8 20 30 40 00  movl    $4206624, %eax
DISASM-NEXT: 102e:      e9 0a 00 00 00  jmp     0x40103d <.text+0x3d>
DISASM-NEXT: 1033:      b8 24 30 40 00  movl    $4206628, %eax
DISASM-NEXT: 1038:      e9 00 00 00 00  jmp     0x40103d <.text+0x3d>
DISASM-NEXT: 103d:      51      pushl   %ecx
DISASM-NEXT: 103e:      52      pushl   %edx
DISASM-NEXT: 103f:      50      pushl   %eax
DISASM-NEXT: 1040:      68 00 20 40 00  pushl   $4202496
DISASM-NEXT: 1045:      e8 b6 ff ff ff  calll   0x401000 <.text>
DISASM-NEXT: 104a:      5a      popl    %edx
DISASM-NEXT: 104b:      59      popl    %ecx
DISASM-NEXT: 104c:      ff e0   jmpl    *%eax
